﻿@{
    Layout = "_mainLayout.cshtml";

  var did = Request.QueryString[0];

  if(did!=null)
  {
      
      if(did.Length>0)
      {
          
          Session["did"]=did;
      }
  }

  var db = Database.Open("EPS");
  var row = db.QuerySingle("SELECT * FROM awaitinguser WHERE deviceid = '"+Session["did"]+"'");
  

  var a = row.deviceid.ToString();
  var b = row.fname.ToString();
  var c = row.lname.ToString();
  var d = row.age.ToString();
  var e = row.city.ToString();
  var f = row.country.ToString();
  var g = row.gender.ToString();
  var h = row.username.ToString();
  var i = row.password.ToString();

  db.Close();
  

  if( IsPost && did!= null) {
     
      var db1 = Database.Open("EPS");
    var insertQuery = "INSERT INTO approveduser VALUES ('"+a+" ','"+b+"','"+c+"','"+d+"','"+e+"','"+f+"','"+g+"','"+h+"','"+i+"')";  
   
    db1.Execute(insertQuery);
    
    

    var deleteQueryString = "DELETE FROM awaitinguser WHERE deviceid='"+Session["did"]+"'";
    


    db1.Execute(deleteQueryString, did);
    Response.Redirect("~/AwaitingUsers.cshtml");
    
    db1.Close();
  }

    
}

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
         <div>
  <h1></br></br>Approve User - Confirmation</h1>
  <form method="post" action="" name="form">
    <p>Are you sure you want to approve this user?</p>
     
    <p>
       
    
    </p>

    <p><input type="submit" value="Approve" /></p>

    <a href="~/AwaitingUsers.cshtml" style="color: #0094ff">Go Back</a>
      
  </form>
    </div>

        
    </body>
</html>
